from flask import Flask, session, flash, get_flashed_messages

app = Flask(__name__)
app.secret_key = 'asdfasdfasdf'


@app.route('/x1', methods=['GET', 'POST'])
def login():
    flash('我要上向龙1', category='x1')
    flash('我要上向龙2', category='x2')
    return "视图函数x1"


@app.route('/x2', methods=['GET', 'POST'])
def index():
    data = get_flashed_messages(category_filter=['x1'])
    print(data)
    data = get_flashed_messages(category_filter=['x1'])
    print(data,222)
    return "视图函数x2"


if __name__ == '__main__':
    app.run()

"""
['我要上向龙1', '我要上向龙1']
['我要上向龙1', '我要上向龙1'] 222
[]
[] 222
 当访问第二次的时候，就为空了 ，只保存一次，调用得到后就删掉其实就是在内部删掉了session.pop() 
 用session也可以做就是session.pop
"""